package com.woniuxy.service.impl;

import com.woniuxy.dao.UserDao1;
import com.woniuxy.service.UserService;
import org.apache.ibatis.session.SqlSession;
import org.apache.ibatis.session.SqlSessionFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Propagation;
import org.springframework.transaction.annotation.Transactional;

import java.util.HashMap;
import java.util.List;
import java.util.Map;

/**
 * @Author: 马宇航
 * @Todo: TODO
 * @DateTime: 01/19/0019 下午 3:08
 * @Component: 成都蜗牛学苑
 **/
@Service("userService")
public class UserServiceImpl implements UserService {
    @Autowired//通过注解进行自动装配，默认先使用的是byType进行装配
    UserDao1 userDao;

    @Override
    @Transactional
    public List<Map<String, String>> findAll() {
        Map<String, String> objectObjectHashMap = new HashMap<>();
        objectObjectHashMap.put("account","test");
        userDao.insert(objectObjectHashMap);
//        this.updateOne();
        return  userDao.findAll();
    }
    @Override
    @Transactional
    public void updateOne() {
        Map<Object, Object> objectObjectHashMap = new HashMap<>();
        objectObjectHashMap.put("account","updateName");
        objectObjectHashMap.put("id","18");
        userDao.updateOne(objectObjectHashMap);
        int i = 1/0;
    }
}
